
 begintownscript;

 variables;

 int i,j,k,r1,choice;

 body;

 beginstate INIT_STATE;

	if (get_flag(14,3) == 1) {
		set_terrain(11,8,0);
		set_terrain(9,10,0);
		set_terrain(7,13,0);
		set_terrain(12,12,0);
		set_terrain(15,10,0);
		activate_hidden_group(1);
}

break;

 beginstate START_STATE;

break;
		
 beginstate EXIT_STATE;

break;

 beginstate 10;
	move_to_new_town(10,19,21);
break;

 beginstate 11;
	move_to_new_town(15,6,38);
break;

 beginstate 12;
	if (get_flag(10,1) == 2) {
		reset_dialog();
		add_dialog_str(0,"An old protective rune has been placed here. It is still glowing slightly, radiating magic. You have to cross it in order to move on.",0);
		add_dialog_str(1,"How do you cross it?",0);
		add_dialog_choice(0,"Step on the rune.");
		add_dialog_choice(1,"Jump over the rune.");
		choice = run_dialog(1);

	if (choice == 1)
		message_dialog("As soon as you step on the rune it completely dims out. You cross it then wait for a while. The rune starts to glow again in a few seconds. But as long as you step on it, you should be fine.","");

	if (choice == 2)
		set_state_continue(20);
}
 break;

 beginstate 13;
	if (get_flag(14,0) == 0) {
		message_dialog("Something's wrong. You keep getting the idea that you should turn back and not continue on this passage. What you do not understand is, where that idea came from. It's like something in your head is telling you to turn back.","");
		set_flag(14,0,1);
}
 break;

 beginstate 14;
	if (get_flag(14,1) == 0) {
		message_dialog("You clearly hear a voice screaming inside your head. _LEAVE! DO NOT COME FURTHER!_ The voice sounds anguished and frightened. What could it be?","");
		set_flag(14,1,1);
}
 break;

 beginstate 15;
	if (get_flag(14,2) == 0) {
		message_dialog("You squint your eyes. There is something wrong with your perception. You can't quite make out what it is. You see a deep chasm, leading deep into the earth, and you see rocks.","What could be wrong?");
		set_flag(14,2,1);
}
 break;

 beginstate 16;
	if (get_flag(14,3) == 0) {
		message_dialog("The rocks around you begin to shake. They aren't rocks after all. They begin to transform into purple hovering masses, Eye Beasts! They have been messing with your heads, but you were close to them long enough for you to see through their disguise.","Not that it's entirely a good thing. Now you must fight them.");
		set_flag(14,3,1);
		activate_hidden_group(1);
		set_terrain(11,8,0);
		set_terrain(9,10,0);
		set_terrain(7,13,0);
		set_terrain(12,12,0);
		set_terrain(15,10,0);
		place_monster(11,8,64,0);
		place_monster(9,10,93,0);
		place_monster(7,13,64,0);
		place_monster(12,12,93,0);
		place_monster(15,10,64,0);
}
 break;

 beginstate 17;
	if (get_flag(14,4) == 0)
		message_dialog("You notice natural light coming from the cave ahead. The passage to the northern valley lies ahead.","");
		set_flag(14,4,1);
 break;
	
 beginstate 20;
	message_dialog("You figure our that the rune will give anything that floats above it a magic shock. You base this opinion on the fact that as soon as you jumped over the rune, you received a strong magical shock.","");
	damage_char(1000,100,3);
 break;